10 loops, best of 3: 152 ms per loop
Precomputing distributions... will take a second
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-7-d99b3a6cb11f> in <module>()
20
21 get_ipython().magic(u'timeit image, output = get_data( data_root + all_paths[0] )')
---> 22 get_ipython().magic(u'timeit image2, output2 = image_path_to_image_and_distribution_tensor( data_root + all_paths[0] )')
23
24 display(get_colorized_image(image, upscale(output)))
/afs/csail.mit.edu/u/k/kocabey/.virtualenvs/tensorflow/local/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
2156 magic_name, _, magic_arg_s = arg_s.partition(' ')
2157 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2158 return self.run_line_magic(magic_name, magic_arg_s)
2159
2160 #-------------------------------------------------------------------------
/afs/csail.mit.edu/u/k/kocabey/.virtualenvs/tensorflow/local/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
2077 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2078 with self.builtin_trap:
-> 2079 result = fn(*args,**kwargs)
2080 return result
2081
<decorator-gen-58> in timeit(self, line, cell)
/afs/csail.mit.edu/u/k/kocabey/.virtualenvs/tensorflow/local/lib/python2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
186 # but it's overkill for just that one bit of state.
187 def magic_deco(arg):
--> 188 call = lambda f, *a, **k: f(*a, **k)
189
190 if callable(arg):
/afs/csail.mit.edu/u/k/kocabey/.virtualenvs/tensorflow/local/lib/python2.7/site-packages/IPython/core/magics/execution.pyc in timeit(self, line, cell)
1042 number = 1
1043 for _ in range(1, 10):
-> 1044 time_number = timer.timeit(number)
1045 worst_tuning = max(worst_tuning, time_number / number)
1046 if time_number >= 0.2:
/afs/csail.mit.edu/u/k/kocabey/.virtualenvs/tensorflow/local/lib/python2.7/site-packages/IPython/core/magics/execution.pyc in timeit(self, number)
137 gc.disable()
138 try:
--> 139 timing = self.inner(it, self.timer)
140 finally:
141 if gcold:
<magic-timeit> in inner(_it, _timer)
<ipython-input-6-f9484c356161> in image_path_to_image_and_distribution_tensor(path)
18 for x in xrange(w):
19 for y in xrange(h):
---> 20 dist[x][y] = _map_ab_to_distribution(np.floor(img[4 * x][4 * y]).tolist())
21
22 return lab_img[:, :, 0], dist
<ipython-input-6-f9484c356161> in _map_ab_to_distribution(ab)
56 '''Map an integer (a,b) tuple to a 313 deep distribution.'''
57 if len(ab_to_dist) == 0:
---> 58 _precompute_distributions()
59
60 return ab_to_dist[ab]
<ipython-input-6-f9484c356161> in _precompute_distributions()
49 dist = gaussian_distances / np.sum(gaussian_distances)
50
---> 51 ab_to_dist[[a, b]] = dist
52 print "Done"
53
TypeError: unhashable type: 'list'